package pers.billy.test.memory;

/**
 * 栈深度异常测试
 *
 * @author billymac
 * @version 1.0
 * @date 17/6/16  下午6:48
 * @since JDK1.8
 */
public class StackOverFlowErrorEntity {

    long deps = 0;

    /**
     * 深度测试
     */
    public void depsTest() {
        deps++;
        depsTest();
    }

    /**
     * 深度测试
     */
    public void depsTest(long a) {
        int d = 0;
        boolean flag = false;
        deps++;
        depsTest(a);
    }

    /**
     * 深度测试
     */
    public void depsTest(long a, long b) {
        deps++;
        depsTest(a + b);
    }

    /**
     * 深度测试
     */
    public void depsTest(long a, long b, long c) {
        deps++;
        depsTest(a + b + c);
    }

    /**
     * 测试
     */
    public void test() {
        try {
            depsTest();
        } catch (Throwable var) {
            System.out.println("deps0 : " + deps);
            var.printStackTrace();
        }
    }

    /**
     * 测试
     */
    public void test(int a) {
        try {
            depsTest(a);
        } catch (Throwable var) {
            System.out.println("deps1 : " + deps);
            var.printStackTrace();
        }
    }

    /**
     * 测试
     */
    public void test(int a, int b) {
        try {
            depsTest(a, b);
        } catch (Throwable var) {
            System.out.println("deps2 : " + deps);
            var.printStackTrace();
        }
    }

    /**
     * 测试
     */
    public void test(int a, int b, int c) {
        try {
            depsTest(a, b, c);
        } catch (Throwable var) {
            System.out.println("deps3 : " + deps);
            var.printStackTrace();
        }
    }
}
